﻿namespace PhotobucketNet
{
    using System;
    using System.Xml;

    public class MetaData
    {
        private string _comment;
        private int _height;
        private string _resolution;
        private int _width;

        private MetaData()
        {
        }

        internal static MetaData CreateFromXmlResponseMessage(XmlResponseMessage responseMessage)
        {
            MetaData data = new MetaData();
            XmlNode node = responseMessage.ResponseXml.SelectSingleNode("descendant::exif");
            XmlNode node2 = node.SelectSingleNode("descendant::Resolution");
            data._resolution = node2.InnerText;
            XmlNode node3 = node.SelectSingleNode("descendant::Comment");
            data._comment = node3.InnerText;
            XmlNode node4 = responseMessage.ResponseXml.SelectSingleNode("descendant::width");
            data._width = Convert.ToInt32(node4.InnerText);
            XmlNode node5 = responseMessage.ResponseXml.SelectSingleNode("descendant::height");
            data._height = Convert.ToInt32(node5.InnerText);
            return data;
        }

        public string Comment
        {
            get
            {
                return this._comment;
            }
        }

        public int Height
        {
            get
            {
                return this._height;
            }
        }

        public string Resolution
        {
            get
            {
                return this._resolution;
            }
        }

        public int Width
        {
            get
            {
                return this._width;
            }
        }
    }
}

